package org.firebug.spring.boot.activemq.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.messaging.Message;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class ConsumerListener {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

//    @JmsListener(destination = "queue.felix", concurrency = "1")
    public void queue(@Headers Map<String, String> header, Message message) {
        String thread = Thread.currentThread().getName();
        logger.info("queue: {}, header: {}, message: {}", thread, header, message);
    }

//    @JmsListener(destination = "topic.felix", concurrency = "1")
    public void topic(@Headers Map<String, String> header, String message) {
        String thread = Thread.currentThread().getName();
        logger.info("topic: {}, header: {}, message: {}", thread, header, message);
    }
}
